package main.java.indi.zyj.sword;

import java.util.HashMap;
import java.util.Map;

public class TwoSum {

    public int[] twoSum(int[] price, int target) {
        int i = 0, j = price.length - 1;
        while(i < j) {
            int s = price[i] + price[j];
            if(s < target) i++;
            else if(s > target) j--;
            else return new int[] { price[i], price[j] };
        }
        return new int[0];
    }

}
